/********************************************************
 Name          : PICO_CELL_01.h
 Author        : Papazyan Tigran
 Copyright     : Copyright by Antel Systems
 Description   :
 **********************************************************/

#ifndef _PICO_CELL_01_H_
#define _PICO_CELL_01_H_

#include "compiler.h"

#define _STANDARDS

// RCOsc has no custom calibration by default. Set the following definition to
// the appropriate value if a custom RCOsc calibration has been applied to your
// part.
#define FRCOSC          AVR32_PM_RCOSC_FREQUENCY              //!< RCOsc frequency: Hz.

#define FOSC32          32768                                 //!< Osc32 frequency: Hz.
#define OSC32_STARTUP   AVR32_PM_OSCCTRL32_STARTUP_8192_RCOSC //!< Osc32 startup time: RCOsc periods.

#define FOSC0           16000000                              //!< Osc0 frequency: Hz.
#define OSC0_STARTUP    AVR32_PM_OSCCTRL0_STARTUP_2048_RCOSC  //!< Osc0 startup time: RCOsc periods.

// Osc1 crystal is not mounted by default. Set the following definitions to the
// appropriate values if a custom Osc1 crystal is mounted on your board.
//#define FOSC1           12000000                              //!< Osc1 frequency: Hz.
//#define OSC1_STARTUP    AVR32_PM_OSCCTRL1_STARTUP_2048_RCOSC  //!< Osc1 startup time: RCOsc periods.

/*! \name SPI Connections of the AT25DFX,CMX7164,HDG104 Components
 */
//! @{
#define SPI_MODULE                 (&AVR32_SPI)
#define AT25DFX_SPI_NPCS            0
#define HDG104_SPI_NPCS             1
#define CMX7164_SPI_NPCS            2
#define SPI_SCK_PIN                 AVR32_SPI_SCK_0_0_PIN
#define SPI_SCK_FUNCTION            AVR32_SPI_SCK_0_0_FUNCTION
#define SPI_MISO_PIN                AVR32_SPI_MISO_0_0_PIN
#define SPI_MISO_FUNCTION           AVR32_SPI_MISO_0_0_FUNCTION
#define SPI_MOSI_PIN                AVR32_SPI_MOSI_0_0_PIN
#define SPI_MOSI_FUNCTION           AVR32_SPI_MOSI_0_0_FUNCTION
#define AT25DFX_SPI_NPCS_PIN        AVR32_SPI_NPCS_0_0_PIN
#define AT25DFX_SPI_NPCS_FUNCTION   AVR32_SPI_NPCS_0_0_FUNCTION
#define HDG104_SPI_NPCS_PIN         AVR32_SPI_NPCS_1_0_PIN
#define HDG104_SPI_NPCS_FUNCTION    AVR32_SPI_NPCS_1_0_FUNCTION
#define CMX7164_SPI_NPCS_PIN        AVR32_SPI_NPCS_2_0_PIN
#define CMX7164_SPI_NPCS_FUNCTION   AVR32_SPI_NPCS_2_0_FUNCTION
//! @}

#define CMX7164_GPIO_IRQ_PIN 		AVR32_EIC_EXTINT_6_PIN
#define CMX7164_GPIO_IRQ_FUNCTION	AVR32_EIC_EXTINT_6_FUNCTION
#define CMX7164_RESET_PIN			AVR32_PIN_PA22

#define WIFI_GPIO_RESET_PIN 		AVR32_PIN_PA05
#define WIFI_GPIO_IRQ_PIN 			AVR32_PIN_PB03//AVR32_EIC_EXTINT_7_PIN
#define WIFI_GPIO_IRQ_FUNCTION		AVR32_EIC_EXTINT_7_FUNCTION

#define PWRSRC_ADC_INPUT_PIN		AVR32_ADC_AD_0_PIN
#define PWRSRC_ADC_INPUT_FUNCTION	AVR32_ADC_AD_0_FUNCTION
#define PWRSRC_ADC_CHANNEL          0

#define TRANSCEIVER_SHDN_OUTPUT_PIN	AVR32_PIN_PA04

#define PGOOD_INPUT_PIN			AVR32_PIN_PA06
#define TXEN_OUTPUT_PIN			AVR32_PIN_PA07

//{ LMX2541 GPIO SPI
#define LMX2541_DATA_OUT_PIN	AVR32_PIN_PA21
#define LMX2541_LE_PIN			AVR32_PIN_PA08
#define LMX2541_FTEST_PIN		AVR32_PIN_PA10
#define LMX2541_CLK_PIN			AVR32_PIN_PA19
//}

/* UART */
#define USART1               (&AVR32_USART1)
#define USART1_RX_PIN        AVR32_USART1_RXD_0_0_PIN
#define USART1_RX_FUNCTION   AVR32_USART1_RXD_0_0_FUNCTION
#define USART1_TX_PIN        AVR32_USART1_TXD_0_0_PIN
#define USART1_TX_FUNCTION   AVR32_USART1_TXD_0_0_FUNCTION
#define USART1_RTS_PIN		 AVR32_USART1_RTS_0_0_PIN
#define USART1_RTS_FUNCTION  AVR32_USART1_RTS_0_0_FUNCTION
#define USART1_CTS_PIN		 AVR32_USART1_CTS_0_0_PIN
#define USART1_CTS_FUNCTION  AVR32_USART1_CTS_0_0_FUNCTION
#define USART1_DTR_PIN		 AVR32_PIN_PA20
#define USART1_DSR_PIN		 AVR32_PIN_PA13
#define USART1_CLOCK_MASK    AVR32_PIN_PA28//AVR32_USART1_CLK_PBA
#define USART1_IRQ           AVR32_USART1_IRQ

#define INT0	0
#define INT1	1
#define INT2	2
#define INT3	3

/* Reserved for Bluetooth/WLAN  communication  */
/*
#define BTTXD				AVR32_PIN_PA26
#define BTRXD				AVR32_PIN_PA27
#define BTSLOT				AVR32_PIN_PA28
#define BTACT				AVR32_PIN_PA29
#define BTEN				AVR32_PIN_PA30
#define BTRTS				AVR32_PIN_PB00
#define BTCTS				AVR32_PIN_PB01
*/
/***********************************************/

/*LED*******************************************/
#define LED_ALARM_STATUS_GRN		AVR32_PIN_PB06  // Alarm/Status Green LED pin assignment
#define LED_ALARM_STATUS_RED 		AVR32_PIN_PB07  // Alarm/Status Red LED pin assignment
#define LED_STATE_GRN 	 			AVR32_PIN_PB08  // State Green LED pin assignment
#define LED_STATE_RED 				AVR32_PIN_PB09  // State Red LED pin assignment
#define LED_MODE_GRN 				AVR32_PIN_PA26  // Mode Green LED pin assignment
#define LED_MODE_RED 				AVR32_PIN_PA27  // Mode Red LED pin assignment
/*LED*******************************************/
#define BOARD_OSC0_HZ 16000000//iiiiiiiiiiiiiiiiiiiiiiiii
#define BOARD_OSC0_STARTUP_US 0//iiiiiiiiiiiiiiiiiiiiiiiiii
#endif  // _PICO_CELL_01_H_
